package cn.javav.sso.dao.impl;

import org.hibernate.Query;
import org.springframework.stereotype.Component;

import cn.javav.sso.dao.UserDao;
import cn.javav.sso.entity.User;

@Component("UserDao")
public class UserDaoImpl extends BasoDaoImpl<User> implements UserDao{

	@Override
	public User getByAccount(String account) {
		Query query = sessionFactory.getCurrentSession().createQuery("FROM User WHERE userAccount = ?");
		query.setString(0, account);
		if(query.list().size() > 0){
			return (User) query.list().get(0);
		}
		return null;
	}
	
}
